home *** CD-ROM | disk | FTP | other *** search
- Path: due.unit.no!hff44-52
- From: davidk@james.stud.unit.no (David Kaasen)
- Newsgroups: comp.lang.c
- Subject: Re: FORTRAN and floats
- Date: 26 Mar 1996 17:26:02 GMT
- Organization: NTNU
- Message-ID: <4j99ba$562@due.unit.no>
- References: <4j6on8$fif@mozo.cc.purdue.edu>
- NNTP-Posting-Host: hfl216.avh.unit.no
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- Hello,
- I know the safest way of doing this: write the float numbers as
- textstrings. That is, let myFloat be a textfile and use
- fprintf(fOut,"%f",myFloat)
- instead. I don't know much FORTRAN, but I am sure it can read
- textformatted floatingpoint numbers.
-
- David Kaasen <davidk@james.stud.unit.no>
-
- In article <4j6on8$fif@mozo.cc.purdue.edu>, rwa@bragg.bio.purdue.edu wrote:
- >I write a "float" from C in Ultrix to a disk file as follows:
- > fwrite(&myFloat,sizeof(float),1,fOut);
- >I get over to my Alpha Open VMS box and try and read it with FORTRAN and
- >get gibberish. (Also can't do when writing from FORTRAN/VMS and reading in
- Ultrix/C).
- >So FORTRAN/VMS likes a different format for floats than C/Ultrix.
- >This is a portability issue that I'm sure there's a "clean" way to
- >solve it - does anyne have any ideas for me???
- >Rob
- >rwa@babe.bio.purdue.edu
-